#ifndef __AS_HYPERLINK_H__
#define __AS_HYPERLINK_H__

#include "ASLabel.h"

#define AS_HYPER_LINK_MAX_LEN 256

typedef enum
{
    AS_HL_STATE_NORMAL,//default state
    AS_HL_STATE_SELECTED,//selected by any action(key or pen)
    AS_HL_STATE_CLICKED,//response in selected state

    AS_HL_STATE_MAX
} as_hyperlink_state;

typedef struct
{
    /* base */
    as_control base;

    /* attributes */
    as_hyperlink_state state;
    ASWCHAR url[AS_HYPER_LINK_MAX_LEN];
    as_label* label;

    /* methods */
    /*
     *	[description] set url of hyperlink
     *  [param] ctrl_p : which you want to set url
     *  [param] url : url encoded in ucs2
     *  [return] as_ret : AS_OK ,or error code
     */
    as_ret (*set_url)(as_control* ctrl_p, ASCHAR *url);

    /*
     *	[description] change status of hyperlink
     *  [param] ctrl_p : which you want to change status
     *  [param] state : status of this control (enum as_hyperlink_state)
     *  [return] as_ret : AS_OK ,or error code
     */
    as_ret (*change_status)(as_control* ctrl_p, as_hyperlink_state state);
    void (*action)(as_control* ctrl_p);
} as_hyperlink;

/*
 *	[description] create a hyperlink control
 *  [param] paint_buf : which buffer do yo want to paint this control
 *  [param] area : control area
 *  [param] text : show text
 *  [param] url : set url
 *  [return] as_hyperlink* : if success return the pointer,else return NULL.
 */
as_hyperlink* as_ctrl_hyperlink_create(as_rect area, ASWSTR text, ASCHAR* url);

/*
 *	[description] destroy a hyperlink control
 *  [param] ctrl_hl_p : which control do you want to destory
 *  [return] as_ret : AS_OK ,or error code
 */
as_ret as_ctrl_hyperlink_destroy(as_hyperlink* ctrl_hl_p);


#endif//__AS_HYPERLINK_H__